
document.addEventListener("DOMContentLoaded", function (event) {
    Highcharts.setOptions({

        colors: [
            '#4E9F8E', '#D9D9D9',
            '#D9D9D9',
            '#5FB7E5', '#AB91C5',
            '#FCC100'


        ]
    });
    Highcharts.chart('chartjs-dashboard-combo', {
        title: {
            text: ' '
        },
        xAxis: {
            categories: [
                "202009",
                "202010",
                "202011",
                "202012",
                "202101",
                "202102"]
        },
        yAxis: [{ // Primary yAxis
            labels: {
                format: '{value} 笔',
                style: {
                    color: Highcharts.getOptions().colors[2]
                }
            },
            title: {
                text: '笔数',
                style: {
                    color: Highcharts.getOptions().colors[2]
                }
            },
            opposite: false

        }, { // Tertiary yAxis
            gridLineWidth: 0,
            title: {
                text: '自动化放款比例',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            labels: {
                format: '{value} %',
                style: {
                    color: Highcharts.getOptions().colors[1]
                }
            },
            opposite: true
        }],
        legend: {

            backgroundColor:
                Highcharts.defaultOptions.legend.backgroundColor || 'white',
            borderColor: '#CCC',
            borderWidth: 1,
            shadow: false
        },
        labels: {
            items: [{
                html: ' ',
                style: {
                    left: '50px',
                    top: '18px',
                    color: ( // theme
                        Highcharts.defaultOptions.title.style &&
                        Highcharts.defaultOptions.title.style.color
                    ) || 'black'
                }
            }]
        },
        credits: {
            enabled: false
        },
        series: [{
            type: 'column',
            name: '放款成功',
            data: [340,
                188,
                228,
                250,
                173,
                118,]
        }, {
            type: 'column',
            name: '放款拒绝',
            data: [
                65,
                41,
                74,
                125,
                91,
                49]
        }, {
            type: 'spline',
            yAxis: 1,
            name: '放款成功-自动放款比例',
            data: [59.78,
                68.00,
                55.62,
                69.74,
                66.95,
                76.64],
            marker: {
                lineWidth: 2,
                lineColor: Highcharts.getOptions().colors[5],
                fillColor: 'white'
            }
        }]
    });

    // Pie chart
    new Chart(document.getElementById("chartjs-dashboard-pie"), {
        type: 'pie',
        data: {
            labels: ["500万以内", "500万以上"],
            datasets: [{
                data: [2408, 150],
                backgroundColor: ["#47BAC1", "#fcc100", "#f44455", "#E8EAED"],
                borderColor: "transparent"
            }]
        },
        options: {
            responsive: !window.MSInputMethodContext,
            maintainAspectRatio: false,
            legend: {
                display: false
            }
        }
    });


Highcharts.setOptions({

    colors: [
        '#4E9F8E',
        '#000000', '#D9D9D9', '#70b299', '#A180DA'
    ]
});
Highcharts.chart('chartjs-dashboard-radar', {
    chart: {
        type: 'column'
    },
    title: {
        text: ' '
    },
    xAxis: {
        categories: ["202004",
            "202005",
            "202006",
            "202007",
            "202008",
            "202009",
            "202010",
            "202011",
            "202012",
            "202101",
            "202102"]
    },
    yAxis: {
        min: 0,
        title: {
            text: 'Total fruit consumption'
        },
        stackLabels: {
            enabled: true,
            style: {
                fontWeight: 'bold',
                color: ( // theme
                    Highcharts.defaultOptions.title.style &&
                    Highcharts.defaultOptions.title.style.color
                ) || 'gray'
            }
        }
    },
    legend: {

        backgroundColor:
            Highcharts.defaultOptions.legend.backgroundColor || 'white',
        borderColor: '#CCC',
        borderWidth: 1,
        shadow: false
    },
    tooltip: {
        headerFormat: '<b>{point.x}</b><br/>',
        pointFormat: '{series.name}: {point.y}<br/>Total: {point.stackTotal}'
    },
    plotOptions: {
        column: {
            stacking: 'normal',
            dataLabels: {
                enabled: false
            }
        }
    },
    credits: {
        enabled: false
    },
    series: [{
        name: '民信平台',
        data: [
            0.79,
            0.91,
            1.26,
            0.95,
            1.35,
            5.13,
            1.08,
            0.64,
            5.29,
            0.68,
            6.10,
        ]
    }, {
        name: '中企云链',
        data: [7.91,
            2.69,
            2.45,
            5.13,
            1.38,
            3.02,
            5.31,
            1.30,
            1.88,
            7.07,
            1.41
        ]
    }, {
        name: '比亚迪',
        data: [0.00,
            0.04,
            0.05,
            0.24,
            0.31,
            0.30,
            0.60,
            0.53,
            0.59,
            0.53,
            0.00,

        ]
    }]





});


Highcharts.setOptions({

    colors: [
        '#4E9F8E', '#D9D9D9',

        '#D9D9D9',
        '#5FB7E5', '#AB91C5',
        '#4E9F8E'


    ]
});
Highcharts.chart('chartjs-dashboard-bar-devices', {
    chart: {
        type: 'bar'
    },
    title: {
        text: '  '
    },
    subtitle: {
        text: '  '
    },
    xAxis: {
        categories: ['中企云链', '民信平台', '比亚迪', '河钢', '四川蜀电'],
        title: {
            text: null
        }
    },
    yAxis: [{ // First yAxis
        title: {
            text: '企业户数',
            style: {
                color: '#adadad'
            }
        },

        labels: {
            format: '{value} ',
            style: {
                color: '#adadad'
            }
        },

        min: 0

    }],
    tooltip: {
        valueSuffix: ' millions'
    },
    plotOptions: {
        bar: {
            dataLabels: {
                enabled: true
            }
        }
    },
    legend: {
        borderWidth: 1,
        backgroundColor:
            Highcharts.defaultOptions.legend.backgroundColor || '#FFFFFF',
        shadow: true
    },
    credits: {
        enabled: false
    },
    series: [{
        name: '核心企业:104',

        data: [61, 40, 1, 1, 1]
    }, {
        name: '供应商:747',


        data: [561, 113, 69, 4, 1]
    }]
});
 
        
    });
